#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/3/17 16:57
# @Author : linjinting
# @Project : Flask-WebService
# @File : __init__.py.py
# @Software: PyCharm

import sys
import os

_srcfile = os.path.normcase(__file__)


def get_cur_info():
    frame = sys._getframe()
    return frame.f_back


def find_caller():
    f = get_cur_info()
    if f is not None:
        f = f.f_back
    rv = ("(unknown file)", "(unknown function)", 0)
    while hasattr(f, "f_code"):
        co = f.f_code
        filename = os.path.normcase(co.co_filename)
        if filename == _srcfile:
            f = f.f_back
            continue
        rv = (co.co_filename, co.co_name, f.f_lineno)
        break
    return rv
